#include "Cube.h"

Cube::Cube(const float *s, unsigned char *c, float *m)
{
    if (m)
    {
	for (int i = 0; i < 4 * 4; ++i)
	{
	    _m[i] = m[i];
	}
    }
    else
    {
	for (int i = 0; i < 4 * 4; ++i)
	{
	    _m[i] = 0.0;
	}

        _m[0] = 1.0;
        _m[5] = 1.0;
        _m[10] = 1.0;
        _m[15] = 1.0;
    }

    color[0] = c[0];
    color[1] = c[1];
    color[2] = c[2];

    size = 1;

    scale[0]=s[0];
    scale[1]=s[1];
    scale[2]=s[2];
}

void Cube::renderInLocalFrame() const
{    
    glScalef(scale[0], scale[1], scale[2]);
    glColor3ubv(color);
    glutSolidCube(size);
}
